Skip to content

Conversation

@premii
Copy link
Contributor

@premii premii commented Jun 30, 2015

Right now, one of the item returns null from firebase, and api fails with {"error":"Cannot read property 'descendants' of null"}

@cheeaun
Copy link
Owner

cheeaun commented Jun 30, 2015

Hmm, I think I tried to fix this for comments here: 9054d3c but didn't know it happens for stories too. If for comments, I feel that it's fine that one or two of them fails and "missing" from the response. But for stories... that's kinda weird 😕 especially when the API response looks like [STORY, STORY, null, STORY, STORY, ...].

Probably would be better to remove the null from the array?

@shamsulbuddy
Copy link

I have handled it just by checking whether Item is nulll of not as below
Promise.all(itemFetches).then(function(res){
var apiRes = res.map(function(item){
if (item) { <--- Added this .. and this fixed this issue for me.

@cheeaun cheeaun added the bug label Jul 3, 2015
@premii
Copy link
Contributor Author

premii commented Jul 6, 2015

I think it would be better to remove the null from the array.

I was worried about [STORY, STORY, null, STORY, STORY, ...], but my FE handled null properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants